//package com.glsc.ngateway.flowable.config;
//
//import com.alibaba.druid.filter.logging.Slf4jLogFilter;
//import com.alibaba.druid.pool.DruidDataSource;
//import com.alibaba.druid.support.http.StatViewFilter;
//import com.alibaba.druid.support.http.StatViewServlet;
//import com.alibaba.druid.support.http.WebStatFilter;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.boot.web.servlet.ServletRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.filter.CompositeFilter;
//
//import javax.sql.DataSource;
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.Map;
//
//@Configuration
//public class DruidConfig{
//
//    @ConfigurationProperties(prefix= "spring.datasource")
//    @Bean
//    public DataSource druid(){
//        DruidDataSource d = new DruidDataSource();
//
//        return d;
//    }
//
//    //配置Druid监控
//    @Bean
//    public ServletRegistrationBean statViewServlet(){
//        ServletRegistrationBean bean=new ServletRegistrationBean(new StatViewServlet(),"/druid/*");
//
//        Map<String,String> initParams=new HashMap<>();
//        initParams.put("loginUsername","admin");
//        initParams.put("loginPassword","admin");
//        initParams.put("allow","10.1.81.198");//默认允许所有访问
//
//        bean.setInitParameters(initParams);
//        return bean;
//    }
//
//    //配置一个web监控的filter
//    @Bean
//    public FilterRegistrationBean webStatFilter(){
//        FilterRegistrationBean bean=new FilterRegistrationBean();
//        WebStatFilter statFilter = new WebStatFilter();
//        statFilter.setProfileEnable(true);
//        statFilter.setSessionStatEnable(true);
//        bean.setFilter(statFilter);
////        bean.setFilter(new StatViewFilter());
//
//        Map<String,String> initParams=new HashMap<>();
//        initParams.put("exclusions","*.js,*.css,/druid/*");
//
//        bean.setInitParameters(initParams);
//        bean.setUrlPatterns(Arrays.asList("/*"));
//        return bean;
//    }
//}